package util;

public class Timer {
	
	private double time;
	private double cur;
	private double start;
	private double end;

	public Timer() {
		time = 0;
		cur = 0;
		start = 0;
		end = 0;
	}
	
	public void start(){
		start = System.currentTimeMillis();
		time = 0;
		cur = 0;
		end = 0;
	}

	public void stop(){
		end = System.currentTimeMillis();
		cur = end - start;
		time = time + cur;
		start = 0;
	}
	
	public void pause(){
		end = System.currentTimeMillis();
		cur = end - start;
		time = time + cur;
		start = 0;
	}
	
	public void resume(){
		start = System.currentTimeMillis();
		cur = 0;
		time = time + cur;
		end = 0;
	}
	
	public double getTimeMiliSec(){
		return time;
	}
	
	public double getTimeSec(){
		return time/1000.0;
	}
	
}
